execute as @e[type=item_frame,nbt={Tags:["entity_stoper_hopper"]}] run data modify entity @s ItemRotation set value 0
execute as @e[type=item_frame,nbt={Tags:["entity_stoper_hopper"]}] at @s if entity @e[distance=..1.5,type=item_frame,nbt={Tags:["wire"]},tag=hasPower] run execute as @s[type=item_frame,nbt={Tags:["entity_stoper_hopper"]}] at @s run execute as @e[distance=..1] run data modify entity @s Motion[0] set value 0d
execute as @e[type=item_frame,nbt={Tags:["entity_stoper_hopper"]}] at @s if entity @e[distance=..1.5,type=item_frame,nbt={Tags:["wire"]},tag=hasPower] run execute as @s[type=item_frame,nbt={Tags:["entity_stoper_hopper"]}] at @s run execute as @e[distance=..1] run data modify entity @s Motion[2] set value 0d
execute as @e[type=item_frame,nbt={Tags:["entity_stoper_hopper"]}] at @s if entity @e[distance=..1.5,type=item_frame,nbt={Tags:["wire"]},tag=hasPower] run execute as @s[type=item_frame,nbt={Tags:["entity_stoper_hopper"]}] if entity @e[distance=..1,type=!item_frame,type=!player] at @s run execute as @e[distance=..1] run tag @e[distance=..1.5,type=item_frame,nbt={Tags:["wire"]},tag=hasPower,limit=1,sort=random] remove hasPower
execute as @e[type=item_frame,nbt={Tags:["entity_stoper_hopper"]}] at @s if entity @e[distance=..1.5,type=item_frame,nbt={Tags:["wire"]},tag=hasPower] run execute as @s[type=item_frame,nbt={Tags:["entity_stoper_hopper"]}] at @s unless block ~ ~-1 ~ hopper